/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package lineage.packet.server;

import java.io.IOException;

import lineage.core.Opcodes;
import lineage.packet.L1AbstractPacketServer;

/**
 * 登入状态(输入账号密码按下确认后).
 * 
 * @version 2014年3月13日下午10:02:15
 * @author jrwz
 */
public final class S_LoginResult extends L1AbstractPacketServer {
    private byte[] _byte = null;
    /** 登入成功 (无提示/无显示). */
    public static final int REASON_LOGIN_OK = 0;
    /** 回到登入画面. */
    public static final int EVENT_RE_LOGIN = 4;
    /** 已经有同样的帐号。请重新输入。 */
    public static final int REASON_ACCOUNT_ALREADY_EXISTS = 7;
    /** 密码错误。 */
    public static final int EVENT_PASSWORD_ERROR = 8;
    /** 错误的密码。请再次确认您所输入的密码是否正确。 */
    public static final int EVENT_PASSWORD_ERROR_CHECK = 10;
    /** 您的电子邮件是无效的。请重新输入正确的电子邮件地址。 */
    public static final int EVENT_MAIL_ERROR = 11;
    /** 国家名称是无效的。请重新输入国家名称。 */
    public static final int EVENT_CN_ERROR = 17;
    /** 已使用中。 */
    public static final int REASON_ACCOUNT_IN_USE = 22;
    /** 您的帐号目前无法使用，密码错误或其他原因。可以登录tiantang.qq.com查询。 */
    public static final int EVENT_ACCOUNT_CANT_USE = 26;
    /** 您无法顺利登入，可能原因如下：1.包月区 间到期，账号内剩余点数不足以继续包月；欲继续包月请储值足够的包月点数，或至天堂官方网站账号管理中心变更计费方式为计时制，即可顺利进行游戏。 */
    public static final int EVENT_CANT_LOGIN = 28;
    /** 无法顺利取得连线. */
    public static final int EVENT_LAN_ERROR = 39;
    /** 用户注册介面(乱码/界面也混乱). */
    public static final int EVENT_REGISTER_ACCOUNTS = 47;
    /** 您的天堂点数已经使用完毕，请至开卡中心确认剩余点数并转移点数至天堂游戏中。 */
    public static final int EVENT_CLOCK_CARDS_ERROR = 50;
    /** 这个角色名称是不合法的。 */
    public static final int EVENT_CHAR_NAME_ERROR = 52;
    /** 您无法在此变更密码，请上天堂网页开卡中心变更。 */
    public static final int EVENT_CHANGE_PASSWORD_ERROR = 53;
    /** at least one of id and password is not correct - 点击之后直接关闭客户端. */
    public static final int EVENT_ACCOUNT_OR_PASSWORD_ERROR = 149;
    /** can't find service account - 点击之后直接关闭客户端. */
    public static final int EVENT_ACCOUNT_ERROR = 155;

    /**
     * 登入状态(输入账号密码按下确认后).
     * 
     * @param result
     *            - 状态
     */
    public S_LoginResult(final int result) {
        writeC(Opcodes.S_OPCODE_LOGIN_RESULT);
        writeH(result);
        writeD(0x00000000);
        writeD(0x00000000);
        writeD(0x00000000);
    }

    @Override
    public byte[] getContent() throws IOException {
        if (this._byte == null) {
            this._byte = this.getBytes();
        }
        return this._byte;
    }
}
